<html><body><pre><%	
props = new Properties()
props.setProperty('java.naming.factory.initial', 'org.jnp.interfaces.NamingContextFactory')
props.setProperty('java.naming.factory.url.pkgs', 'org.jboss.naming:org.jnp.interfaces')
ctx = new javax.naming.InitialContext(props)
dataSource = ctx.lookup("java:/DefaultDS")
ctx.close()

conn = dataSource.getConnection()
try {	
	// Dump DB metaData object with java.beans.Introspector
	md = conn.getMetaData()
	out.println("DataSource Connection MetaData: class=${md}")
	out.println("---")
	beanInfo = java.beans.Introspector.getBeanInfo(md.getClass())
	beanInfo.propertyDescriptors.each { pd -> 
		out.println("  ${pd.getName()}: ${pd.getReadMethod().invoke(md)}")
	}
	
	// Print out default schema table names.
	out.println("")
	out.println("Tables list")
	out.println("---")
	md.getTables(null, null, null, null).each { rs -> 
		while (rs.next()) {
			out.println("  ${rs.getObject('TABLE_NAME')}")
		}
		rs.close()
	}	
} finally {
	if (conn != null) conn.close()
}
%></pre></body></html> 